<link type="text/css" rel="stylesheet" href="/html/styles/shop/shop_buy.css"/>
<?php if ($this->orderArray):?>
  <div class="YourOrders"><strong>Your orders have been placed successfully.</strong>
  PO#:&nbsp;&nbsp;<?foreach($this->orderArray as $value):?> J<?=$value['orderid']?>&nbsp;&nbsp;<?endforeach;?></div>
  <div class="BuyContentTit">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Payment Confirmation</div>
  <div class="RYO4">
  	<?foreach($this->orderArray as $value2):?>
    <ul class="RYO4UL">
      <li class="li1">PO#:J<?=$value2['orderid']?><input type="hidden" value="<?=$value2['orderid']?>" name="orderid[]" /></li>
      <li class="li2">Item</li>
      <li class="li3">Unit Price</li>
      <li class="li4">Quantity</li>
      <li class="li5">Price</li>
	  <?foreach(unserialize($value2['order_string']) as $value):?>
      <li class="li6"><a target="_blank" href="<?php echo $this->url($value['itemid']);?>"><?=$value['subject']?></a></li>
      <li class="li7">
      	<?=$this->numberFormat($value['net_price'],2)?>
      </li>
      <li class="li8"><?=$value['amounts']?></li>
      <li class="li9">USD 
      	<?if($value['buy_name_num']!='' or $value['buy_originalname_num']!=''):?>
            <?if($value['buy_BadgePatch']=='Yes'):?>
                <?=$this->numberFormat($value['amounts']*$value['net_price']+$value['printAmounts']*2+$value['originalprintAmounts']*3+$value['amounts']*2,2)?>
    	    <?else:?>
                <?=$this->numberFormat($value['amounts']*$value['net_price']+$value['printAmounts']*2+$value['originalprintAmounts']*3,2)?>
    	    <?endif;?>
      	<?else:?>
            <?if($value['buy_BadgePatch']=='Yes'):?>
                <?=$this->numberFormat($value['amounts']*$value['net_price']+$value['amounts']*2,2)?>
    	    <?else:?>
                <?=$this->numberFormat($value['amounts']*$value['net_price'],2)?>
    	    <?endif;?>
    	<?endif;?>
      </li>
	  <?endforeach;?>
      <li class="li10">
		<strong><a onclick="return confirmCancel();" href="product-cancelorder?orderid=<?=$value2['orderid']?>">Cancel this order</a></strong>
      </li>
      <li class="li11">
Subtotal: USD <?=$this->numberFormat($value2['money'],2)?>$<br /><br />
Shipping Cost: USD <?=$this->numberFormat($value2['yunfeiprice'],2)?>$<br /><br />
Order Total: <span class="strongSpan" id="wholesaleDiscount">USD <?=$this->numberFormat($value2['money'],2)?></span><br />
      </li>
    </ul>
	<?endforeach;?>
    <ul class="RYO4UL" id="couponsUl">
      <li class="li12">&nbsp;</li>
      <li class="li13">&nbsp;</li>
      <li class="li14">PO#:&nbsp;<?foreach($this->orderArray as $value):?>J<?=$value['orderid']?>&nbsp;&nbsp;<?endforeach;?></li>      
      <li class="li16">Total: <span class="strongSpan" id="wholesaleTotal">USD <?=$this->numberFormat($this->total-$this->conpon,2)?></span></li>
      <?php 
      	$score = new CScore();
      ?>
      <?php if ($score->orderScore('statu') == 1):?>
			<li class="li15">You can get score: <span class="strongSpan" id="wholesaleTotal"><?php echo $score->dollar2score($this->total-$this->conpon);?></span></li>
	  <?php endif?>
    </ul>
    </div>
	<div class="g-bd clearfix">
       <div class="fcj_menu clearfix"> 
    		<form id="paymentForm" action="pay-paypal" method="post">  		
            <h2 class="titlebar">YOUR PAYMENT INFORMATION</h2>
            <h3 class="payment-tlt">Please select method of payment:</h3>
            <div class="order-payment">
            	<div class="mitem method-item"><input name="paymentMethod" onclick="payment.changeTossfkh()" type="radio" value="ssfkh" id="payMentMethod1" /><label for="payMentMethod1">&nbsp;Credit card&nbsp;&nbsp;<span class="lred">Charging fee: $<?=$this->total*(CE_SSFKH-1)?></span></label><span class="credit-card-logo"><img src="images/creditCard.jpg" /></span></div>
                <div class="mitem method-info">Please make sure your credit card verified, our payment only supports validation card. </div>
                <div class="mitem method-item"><input name="paymentMethod" onclick="payment.changeToPaypal()" type="radio" value="paypal" id="payMentMethod2" /><label for="payMentMethod2">&nbsp;Paypal&nbsp;&nbsp;<span class="lred">Charging fee: $<?=$this->total*(PAYPAL_RATE-1)?></span></label><span class="paypal-logo"><img src="images/paypal.gif" /></span></div>
            	<div class="mitem paypal-info">
                	<strong>Please fill up your paypal email, We will send you the Request In 12 Hours for The PayPal payment, Please pay attention for your Paypal email! </strong>
               		<div class="paypal-email">Paypal Account: <input type="text" value="YourMail@email.com" name="paypal_email" id="paypal_email" onfocus="this.value=''"/></div>
                </div>
                <input type="hidden" value="<?=$this->total?>" name="total" />
				<input type="hidden" value="1" name="discount" />
				<input type="hidden" value="<?foreach($this->orderArray as $value2):?>#POJ<?=$value2['orderid']?>,<?endforeach;?>" name="item_name" />
            </div>
            <div class="submit-my-order"><input class="addr-btn1 spbg" type="button" value="Pay My Order" onclick="dopay();"/></div>
        	</form>
        </div>
</div>
<br/>
<?else:?>
	<?=$this->getMsg('No orders temporarily!');?>
<?endif;?>
<script>
$(function(){
	$('#paypalinfo').hide();
});

function confirmCancel(){

	if(confirm("Sure to cancel this order?")){

		return true;

	}else{

		return false;

	}

}
function dopay(){

	var hasSelect=false;
	var pay = '';
	$('input[name="paymentMethod"]').each(

		function(){

			if($(this).attr('checked')==true){
				pay = $(this).val();
				hasSelect=true;
			}

		}

	);

	if(!hasSelect){

		alert('Please select a payment method!');

		$('#paymentForm').submit(

			function(){

				return false;

			}

		);

	}else{
		if (pay == 'paypal' && ($('#paypal_email').val() == '' || $('#paypal_email').val() == 'YourMail@email.com')) {
			
			alert('Please input your email!');
			$('#paymentForm').submit(
					function(){
						return false;
					}
			);
			return;
		}
		$('#paymentForm')[0].submit();

		GGSHOP.loading.show();

	}

}



var payment={

	changeToPaypal:function(){

		$('#paymentForm').attr('action','pay-paypal');
		$('#paypalinfo').show();
	},

        changeTossfkh:function(){

		$('#paymentForm').attr('action','pay-ssfkh');
		$('#paypalinfo').hide();

	},

        changeTossfkhnopass:function(){

		$('#paymentForm').attr('action','pay-nopassssfkh');
		$('#paypalinfo').hide();
	},

	changeToWest:function(){

		$('#paymentForm').attr('action','pay-west');

	},

	changeToTT:function(){

		$('#paymentForm').attr('action','pay-tt');

	}

}
</script>
</div>